# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=at-spi2-core
pkgver=2.50.0
pkgrel=0
pkgdesc="Protocol definitions and daemon for D-Bus at-spi"
url="https://www.freedesktop.org/wiki/Accessibility/AT-SPI2/"
arch="all"
options="!check"  # Requires running dbus daemon.
license="LGPL-2.1-or-later"
makedepends="
	dbus-dev
	glib-dev
	gobject-introspection-dev
	gtk-doc
	libxml2-dev
	libxtst-dev
	meson
	"
subpackages="
	$pkgname-dbg
	$pkgname-dev
	$pkgname-lang
	libatk-1.0:libatk
	libatk-bridge-2.0:libatk_bridge
	"
source="https://download.gnome.org/sources/at-spi2-core/${pkgver%.*}/at-spi2-core-$pkgver.tar.xz"

# both were merged into this
replaces="atk at-spi2-atk"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dx11=enabled \
		-Dintrospection=enabled \
		-Ddocs=false \
		-Ddbus_daemon=/usr/bin/dbus-daemon \
		. build
	meson compile -C build
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build
	rm -rf "$pkgdir"/usr/lib/systemd
}

dev() {
	default_dev
	replaces="atk-dev at-spi2-atk-dev"
}

libatk() {
	pkgdesc="ATK library accessibility interfaces (1.0)"
	amove \
		usr/lib/libatk-1.0* \
		usr/lib/girepository-1.0/Atk-1.0.typelib
}

libatk_bridge() {
	pkgdesc="GTK+2.0 module that bridges ATK to D-Bus at-spi"
	amove \
		usr/lib/gnome-settings-daemon-3.0 \
		usr/lib/gtk-2.0 \
		usr/lib/libatk-bridge-2.0*
}

sha512sums="
7de02efa7e3cb9db4a7da8bb2e9350dc00458e2ba9bf9dafb68d2cab8512b525fc7dcecb45f5912de7459b86d901ab3a188f0a07f5bdc068a51433c900de2308  at-spi2-core-2.50.0.tar.xz
"
